package reflect;


import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class ReflectDemo5 {
    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException, InstantiationException, ClassNotFoundException, NoSuchMethodException {
        Class cls = Class.forName("reflect.person");
        Object obj = cls.newInstance();

        Method method = cls.getMethod("say", String.class);
        method.invoke(obj,"哈哈哈哈");


        Method method1  = cls.getMethod("say", String.class,int.class);
        method1.invoke(obj,"嘿嘿",100);


    }
}
